from tw.api import WidgetsList,CSSLink
from tw.forms import TableForm, TextField, TextArea,HiddenField
from tg import url
from comboselect import ComboSelect
from tw.forms.validators import All,NotEmpty,UnicodeString,Int
from tw.jquery.activeform import AjaxForm
from tw.jquery import js_callback
class EventTypeForm(AjaxForm):
    template = "lifepyscle.widgets.templates.table_form"
    hover_help = True
    submit_text = "Add Event Type"
    success =  js_callback('boom')
    class fields(WidgetsList):
        event_type_id = HiddenField(id='event_type_id',validator=All(NotEmpty(),Int()))
        event_type = TextField(id="type",validator=UnicodeString(),label_text=u"Type:",\
                help_text=u"Short (if possible, an acronym) title of the event type")
        event_description = TextField(id="event_description",validator=All(NotEmpty(),Int()),\
                    help_text=u'Describe the event type so that others can understand',\
                    label_text=u'Description')

event_type_form = EventTypeForm("event_type_form")
